<?php

/**
 * sfGuardUserAdminForm for admin generators
 *
 * @package    sfDoctrineGuardPlugin
 * @subpackage form
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id: sfGuardUserAdminForm.class.php 23536 2009-11-02 21:41:21Z Kris.Wallsmith $
 */
class sfGuardUserAdminForm extends BasesfGuardUserAdminForm
{
  /**
   * @see sfForm
   */
  public function configure()
  {
	$this->widgetSchema['userimage'] = new sfWidgetFormInputFileEditable(array(
		'label'			=> 'Photo',
		'file_src'		=> '/uploads/user/'.$this->getObject()->getUserimage(),
		'is_image'		=> true,
		'edit_mode'		=> !$this->isNew(),
		'template'		=> '<div>%file%<br /><br /><br />%input%<br /><br /><div>%delete% %delete_label%</div></div>',
	));
	
	$this->validatorSchema['image_delete'] = new sfValidatorBoolean();

	$this->validatorSchema['userimage'] = new sfValidatorFile(array(
	  'required'   => false,
	  'path'       => sfConfig::get('sf_upload_dir').'/user',
	  'mime_types' => 'web_images',
	));
  }
}
